﻿function ConvertData(a, b) {
    if (InITIAL) {
        switch (b) {
            case "W":
                if (a.length <= 20) {
                    for (var c = 0; c < a.length; c++) {
                        a[c][27] = SwapOdds(a[c][27]);
                        a[c][28] = SwapOdds(a[c][28]);
                        a[c][32] = SwapOdds(a[c][32]);
                        a[c][33] = SwapOdds(a[c][33]);
                        a[c][40] = SwapOdds(a[c][40]);
                        a[c][41] = SwapOdds(a[c][41]);
                        a[c][45] = SwapOdds(a[c][45]);
                        a[c][46] = SwapOdds(a[c][46])
                    }
                } else {
                    var c = 20;
                    if (a.length <= 50) {
                        c = 0
                    }
                    for (c; c < a.length; c++) {
                        a[c][27] = SwapOdds(a[c][27]);
                        a[c][28] = SwapOdds(a[c][28]);
                        a[c][32] = SwapOdds(a[c][32]);
                        a[c][33] = SwapOdds(a[c][33]);
                        a[c][40] = SwapOdds(a[c][40]);
                        a[c][41] = SwapOdds(a[c][41]);
                        a[c][45] = SwapOdds(a[c][45]);
                        a[c][46] = SwapOdds(a[c][46])
                    }
                }
                break;
            case "UI":
                for (var c = 0; c < a.length; c++) {
                    a[c][27] = SwapOdds(a[c][27]);
                    a[c][28] = SwapOdds(a[c][28]);
                    a[c][32] = SwapOdds(a[c][32]);
                    a[c][33] = SwapOdds(a[c][33]);
                    a[c][40] = SwapOdds(a[c][40]);
                    a[c][41] = SwapOdds(a[c][41]);
                    a[c][45] = SwapOdds(a[c][45]);
                    a[c][46] = SwapOdds(a[c][46])
                }
                break;
            case "UO":
                for (var c = 0; c < a.length; c++) {
                    switch (a[c][1]) {
                        case 1:
                        case 3:
                        case 7:
                        case 8:
                            a[c][4] = SwapOdds(a[c][4]);
                            a[c][5] = SwapOdds(a[c][5]);
                            break;
                        default:
                            break
                    }
                }
                break;
            default:
                break
        }
    }
    return a
}

function SwapOdds(b) {
    if (b == "") {
        return b
    }
    var a = parseFloat(b);
    if (a > 0) {
        return "-" + b
    } else {
        return b.replace("-", "")
    }
}